package com.probiz.estoresf.customer.web.action;

import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.validation.BindException;
import org.springframework.web.servlet.ModelAndView;

import com.probiz.estore.common.model.customer.Feedback;
import com.probiz.estore.core.controller.GenericCustomerFrontController;
import com.probiz.estore.core.search.SearchCriteria;
import com.probiz.estore.customer.service.FeedbackManager;
import com.probiz.estore.webapp.util.RequestContext;

public class CsFeedbackFrontController extends		GenericCustomerFrontController<Feedback> {
	private FeedbackManager feedbackManager;
	protected void initController() throws Exception {
		mgr = feedbackManager;
	}
	public void setFeedbackManager(FeedbackManager feedbackManager) {
		this.feedbackManager = feedbackManager;
	}

	@Override
	protected String getEntityName(Feedback entity) {
		return null;
	}
	@Override
	protected Map<Integer, Map<String, Object>> getMultiSaveModel(
			HttpServletRequest request) {
		return null;
	}
	@Override
	protected void preSave(HttpServletRequest request, Feedback entity,
			BindException errors) {
		
	}
	/*
	 * (non-Javadoc)
	 * @see com.probiz.estore.core.controller.GenericCustomerFrontController#defaultAction(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
	 * 
	 * 我的反馈列表
	 */
	public ModelAndView defaultAction(HttpServletRequest request,HttpServletResponse response) {
		ModelAndView mv = new ModelAndView("customer/csMyFeedbackList");
		SearchCriteria sc = createSearchCriteria(request, Feedback.FilterHqlName.MY_FEEDBACK_LIST);
		sc.removeParamValues();
		sc.addParamValue(RequestContext.getCurrentUserId());
		List<Feedback> feedbackList = this.searchByCriteria(sc);
		mv.addObject("feedbackList", feedbackList);
		mv.addObject("counts", feedbackManager.getCountsOfCustomer(RequestContext.getCurrentUserId()));
		return mv;
	}
	
	
}
